package com.cet.designpatterns.composite;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-12 21:36
 **/
public abstract class OrganizationComponent {

    private String name;
    private String des;

    // 这里不设计成抽象方法，是因为叶子结点不需要实现该操作
    protected void add(OrganizationComponent organizationComponent) {
        // 默认实现
        throw new UnsupportedOperationException();
    }

    protected void remove(OrganizationComponent organizationComponent) {
        // 默认实现
        throw new UnsupportedOperationException();
    }

    public OrganizationComponent(String name, String des) {
        this.name = name;
        this.des = des;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    // 打印方法
    public abstract void print();
}
